<?php

namespace Modules\User\Database\Seeders;

use Illuminate\Database\Seeder;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Schema;

class CustomerDatabaseSeeder extends Seeder
{
    /**
     * Run the database seeds.
     *
     * @return void
     */
    public function run()
    {
        try {
            $module = config('user.name') ?? 'User';
            if (Schema::hasTable('auth_menu')) {
                $data = json_decode(file_get_contents(module_path('User') . DIRECTORY_SEPARATOR . 'menu.php'), true);
                DB::table('auth_menu')->where("module", $module)->delete();
                addInfo($data, 0);
            }
        } catch (\Exception $e) {
            echo $e->getMessage();
        }
    }
}
